﻿#include "Title.h"

void PaintTheText(CDC* mdc, CRect rect,CString str,int Color[], int PosX,int PosY)
{
	CFont new_font;

	//�������������ʽ  100Ϊ�ָ�
	VERIFY(new_font.CreatePointFont(250, _T("����"), mdc));

	//ѡ����������PDC
	CFont* default_font = mdc->SelectObject(&new_font);

	//�������屳��Ϊ͸��
	mdc->SetBkMode(TRANSPARENT);

	//����������ɫ
	rect.OffsetRect(PosX, PosY);
	mdc->SetTextColor(RGB(Color[0], Color[1], Color[2]));
	mdc->DrawText(str, rect,
		DT_SINGLELINE | DT_CENTER | DT_VCENTER);

	//�ָ�PDC��ȱʡ����
	mdc->SelectObject(default_font);

	//�ͷ�font����
	new_font.DeleteObject();
}

void PaintCost(CDC* mdc, CRect rect, CString StringName,CString WordScale,int WordSize, int Number,int Color[] ,int PosX,int PosY)
{
	CFont new_font;

	VERIFY(new_font.CreatePointFont(WordSize, WordScale, mdc));

	CFont* default_font = mdc->SelectObject(&new_font);

	mdc->SetBkMode(TRANSPARENT);
	CString str;
	str.Format(_T("%d"), Number);
	StringName += str;
	mdc->SetTextColor(RGB(Color[0], Color[1], Color[2]));
	rect.OffsetRect(PosX, PosY);

	mdc->DrawText(StringName, rect,
		DT_SINGLELINE | DT_CENTER | DT_VCENTER);

	mdc->SelectObject(default_font);

	new_font.DeleteObject();
}
